.so ../bk-macros
.TH "bk repogca" "\*[BKVER]" %E% "\*(BC" "\*(UM"
.SH NAME
bk repogca \- show greatest common ancestor across a set of repositories
.SH SYNOPSIS
.B bk repogca
.[OPTreq] \-d spec
.[B] \-5kS
[\c
.ARG repo
.ARGc repo
\ .\|.\|.]
.SH DESCRIPTION
This command will print the latest revision in the current repository
that exists in all of the the remote repositories either listed on the
command line or implied in the parent pointer[s].
By default,
.C \`bk parent\`
is the remote repository. 
.SH OPTIONS
.TP \fB\-\-dspecf\=\fP\*<file\*>
.OPTreq \-d spec
Use
.ARG spec
as the specification for displaying the revision.
.tp
.OPTreq \-\-dspecf\= file
Like
.B \-d
but read the dspec from a file.
.tp
.B \-5
A short hand for asking for a spec of \*(lq:MD5KEY:\*(rq.
.tp
.B \-k
A short hand for asking for a spec of \*(lq:KEY:\*(rq.
.tp
.B \-S
In a component in a nested collection, produce the repo gca of the
component instead of the repo gca of the product.
.SH EXAMPLES
To generate a traditional patch for the changes that exist only in the
local repository:
.DS
bk export -tpatch -r\`bk repogca\`,+ > patch
.DE
To throw away all local work that doesn't exist in a remote repository:
.DS
bk undo -a\`bk repogca URL\`
.DE
.B Warning:
This 
.I might
also throw away some local csets which also exist in the remote
repository.
That can happen if there are multiple common ancestors on different
branches.
The ancestor chosen is the one created most recently.
.SH "SEE ALSO"
.SA gca
.SA log
.SH CATEGORY
.B Utility
